<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('orders', function (Blueprint $table){
            $table->engine = 'InnoDB';
            $table->increments('id');
            $table->integer('user_id')->comment('用户id');
            $table->string('people')->comment('使用人');
            $table->string('tel')->comment('联系电话');
            $table->tinyInteger('purpose')->comment('0:其他,1:实习,2:活动');
            $table->dateTime('start_time')->comment('开始时间');
            $table->dateTime('end_time')->comment('结束时间');
            $table->string('bus')->comment('所选车型和数量');
            $table->integer('bus_num')->comment('车辆总数');
            $table->string('start_route')->comment('路线起点');
            $table->string('end_route')->comment('路线终点');
            $table->integer('service_id')->comment('服务商id');
            $table->double('unit_price')->nullable()->comment('单价');
            $table->text('license')->nullable()->comment('车牌号');
            $table->double('kilometers')->nullable()->comment('公里数');
            $table->double('total')->nullable()->comment('总价');
            $table->string('class')->nullable()->comment('班级');
            $table->integer('num_people')->comment('总人数');
            $table->string('view_company')->nullable()->comment('参观公司');
            $table->string('view_content')->nullable()->comment('参观目的');
            $table->string('ps')->nullable()->comment('备注');
            $table->tinyInteger('service_confirm')->default(0)->comment('服务商确认');
            $table->tinyInteger('manage_confirm')->default(1)->comment('管理员确认');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('orders');
    }
}
